#!/bin/bash

profexecutable=main.prof
builddir=build

cd $builddir

for i in `seq 1 100`; do
	./$profexecutable < ../sample.in &> /dev/null
        mv gmon.out gmon.out.$i
done

gprof -s $profexecutable gmon.out.*

for i in `seq 1 100`; do
        rm gmon.out.$i
done


gprof -b $profexecutable gmon.sum > gprof.out

echo "gprof summarized flat profile generated. see "$builddir/gprof.out
